<?php
header('Content-Type: application/json');
$data = array();
if (isset($_REQUEST['key'])) {
	include_once 'main.inc.php';
	include_once 'mysql_connect.php';
	$key = $_REQUEST['key'];
	$word_table_name = WORD_TABLE_NAME;
	$query = "SELECT `key` FROM {$word_table_name} WHERE `key` LIKE '{$key}%';";
	$result = mysql_query($query);
	while ($row = mysql_fetch_array($result)) {
		$data[] = $row['key'];
	}
}
echo json_encode($data);